<?php
	
	require 'configDB.php';
	$id_matpel = $_POST['id_matpel'];
	$id_guru = $_POST['id_guru'];
	$tingkat = $_POST['tingkat'];
	$id_jurusan = $_POST['id_jurusan'];
	$waktu_mulai = $_POST['waktu_mulai'];
	$waktu_selesai = $_POST['waktu_selesai'];
	$hari = $_POST['hari'];
	$no_kelas = $_POST['no_kelas'];
	$id_tahun_ajaran = $_POST['id_tahun_ajaran'];

	$kelas_query = mysql_query("SELECT * FROM kelas WHERE tingkat='$tingkat' AND id_jurusan='$id_jurusan' AND nomor='$no_kelas'");
	$kelas= mysql_fetch_assoc($kelas_query);
	$id_kelas = $kelas['id'];

	//nik, id_matpel, id_tahun_ajaran
	$penugasan_query = mysql_query("SELECT * FROM penugasan_guru WHERE NIK='$id_guru' AND id_matpel='$id_matpel' AND id_tahun_ajaran='$id_tahun_ajaran' ");
	$penugasan =mysql_fetch_assoc($penugasan_query);
	$id_penugasan = $penugasan['id'];

	$query = mysql_query("INSERT INTO jadwal_pelajaran VALUES('$id_kelas' , '$waktu_mulai' , '$waktu_selesai' , '$hari' , '$no_kelas' , '' , '$id_tahun_ajaran' , '$id_penugasan')");

	header("Location: ../laporan_jadwal_pelajaran.php");

?>